import { Button, Form, Input, Select, Space, Badge } from 'antd';


export const AformConfig = [
    {
        type: "Input",
        lable: "名称",
        placenholder: "请输入页面名称",
        key: "name",
    },
    {
        type: "Input",
        lable: "路径",
        placenholder: "请输入页面路径",
        key: "path",
    },
    {
        type: "Select",
        lable: "状态",
        placenholder: "请输入联系方式",
        key: "pass",
        options: [
            {
                key: "1",
                lable: "已发布"
            },
            {
                key: "0",
                lable: "草稿"
            }
        ]
    },
    {
        type: "Find",
        text: "搜索"
    },
    {
        type: "Reset",
        text: "重置"
    }
]

export const tableData = [
    {
        key: '1',
        name: 'John Brown',
        age: 32,
        address: 'New York No. 1 Lake Park',
        tags: ['nice', 'developer'],

    },
    {
        key: '2',
        name: 'Jim Green',
        age: 42,
        address: 'London No. 1 Lake Park',
        tags: ['loser'],
    },
    {
        key: '3',
        name: 'Joe Black',
        age: 32,
        address: 'Sidney No. 1 Lake Park',
        tags: ['cool', 'teacher'],
    },
    {
        title: 'Action',
        key: 'action',
    },
]

export const tableColumns = (

    edit: (record:any, status:any) => void,
    setStatus: (record:any, status:any) => void,
    Find: (record:any, status:any) => void,
    Del: (record:any, status:any) => void) => {
    return [

        {
            title: '名称',
            dataIndex: 'name',
            key: 'name',
        },
        {
            title: '路径',
            dataIndex: 'path',
            key: 'path',
        },
        {
            title: '顺序',
            dataIndex: 'order',
            key: 'order',
        },
        {
            title: '阅读量',
            dataIndex: 'views',
            key: 'views',
        },
        {
            title: '状态',
            dataIndex: 'status',
            key: 'status',
            // render()
            render(text: string) {
                return text === "publish" ? <span><Badge status="success" ></Badge> 已发布</span> : <span><Badge status="warning" ></Badge> 草稿</span>
            }
        },
        {
            title: '发布时间',
            dataIndex: 'publishAt',
            key: 'publishAt',
        },
        {
            title: '操作',
            dataIndex: 'action',
            key: 'action',
            render: (_: any, record: any) => {
                // const id=record.id
                console.log(_, record)
                const id = record.id
                return (
                    <Space>
                        <a onClick={() => edit(record, record.status)}>编辑</a>
                        <a onClick={() => setStatus(record, record.status)}>{record.status === "publish" ? "下线" : "发布"}</a>
                        <a onClick={() => Find(record, record.role)}>查看访问</a>
                        <a onClick={() => Del(record, record.role)}>删除</a>
                    </Space>
                    // <>
                    //     <Button type='link' onClick={()=> PassCommrnt(id,true)}>编辑</Button>
                    //     <Button type='link'>发布</Button>
                    //     <Button type='link' onClick={()=>{Recomment(record)}}>查看访问</Button>
                    //     <Button type='link'>删除</Button>
                    // </>
                )
            }
        }
    ];

}
